/*
** my_del_elem_in_tab.c for del_elem_in_tab in /home/nadali_t//local/re-piscine/jour_04/ex3
** 
** Made by thomas nadalie
** Login   <nadali_t@epitech.net>
** 
** Started on  Thu Dec 15 11:33:44 2011 thomas nadalie
** Last update Fri Jan  6 15:39:48 2012 thomas nadalie
*/

#include	<stdlib.h>

void	my_putchar(char c)
{
  write(1, &c, 1);
}

int	my_putnbr(int nb)
{
  if (nb < 0)
    {
      my_putchar('-');
      nb = nb * -1;
    }
  if (nb > 9)
    my_putnbr(nb / 10);
  my_putchar((nb % 10) + 48);
}

int	*my_del_elem_in_tab(int *tab, unsigned int elem, unsigned int len)
{
  int	*t2;
  int	i;
  int	j;

  i = 0;
  j = 0;
  t2 = malloc(len - 1 * sizeof (int));
  while (i < len)
    {
      if (i == elem)
	  i++;
      else if (!(elem))
	return (NULL);
      else
	{
	  t2[j] = tab[i];
	  i++;
	  j++;
	}
    }
  return (t2);
}
